package com.mall.controller;



import com.mall.pojo.OmsOrderSetting;
import com.mall.service.OmsOrderSettingService;
import com.mall.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.ws.rs.Path;

@RestController
@RequestMapping("/orderSetting")
public class OmsOrderSettingController {

    @Autowired
    private OmsOrderSettingService omsOrderSettingService;

    /**
     * 根据id获取指定订单设置
     * @param id
     * @return
     */
    @GetMapping("/{id}")
    public Result<OmsOrderSetting> findOrderSettingById(@PathVariable(value = "id") Integer id){
        //调用方法进行查询
       OmsOrderSetting omsOrderSetting =  omsOrderSettingService.findOrderSettingById(id);
       //返回结果
       return Result.success(omsOrderSetting,"操作成功");

    }


    @PostMapping("/update/{id}")
    public Result<Integer> updateOrderSetting(@PathVariable("id") Integer id,
                                              @RequestBody OmsOrderSetting orderSetting){
        //调用方法进行修改
       Integer updateNum =  omsOrderSettingService.updateOrderSetting(orderSetting);
       return Result.success(updateNum,"操作成功");



    };



}
